import { Game } from './game-state.js';
import { Enemy } from './enemy.js';

export let lastSpawn = 0;

export function spawnEnemy() {
    // 检查当前敌人数量是否小于 maxEnemies
    if (Game.enemies.length < Game.maxEnemies) {
        // 生成新的敌人
        const newEnemy = new Enemy({
            x: Math.random() * Game.world.width,
            y: Math.random() * Game.world.height,
            direction: Math.random() * Math.PI * 2,
            speed: 2
        });
        Game.enemies.push(newEnemy);
    }
}
